﻿<?xml version="1.0" encoding="utf-8" ?>
<Batch 
    xmlns="http://schemas.dbshell.com/core"
    xmlns:rds="http://schemas.dbshell.com/datasync"
    >
    <rds:SyncModel >
        <rds:SyncModel.Sources>
            <rds:Source DataSource="{Table Source}">
                <rds:SourceColumn Name="MasterId" />
                <rds:SourceColumn Name="DetailId" />
            </rds:Source>
        </rds:SyncModel.Sources>
        <rds:SyncModel.Targets>
            <rds:Target TableName="TargetMaster">
                <rds:TargetColumn Name="MasterIdOriginal" Source="MasterId" IsKey="True" Compare="true"/>
            </rds:Target>

            <rds:Target TableName="TargetDetail">
                <rds:TargetColumn Name="DetailIdOriginal" Source="DetailId" IsKey="True" Compare="true"/>
            </rds:Target>
        </rds:SyncModel.Targets>

        <rds:SyncModel.TargetReferences>
			<rds:TargetReference Source="TargetDetail" Target="TargetMaster" Compare="true">
				<rds:TargetReferenceColumn BaseName="TargetMasterId" RefName="TargetMasterId" />
			</rds:TargetReference>
        </rds:SyncModel.TargetReferences>
    </rds:SyncModel>
    
    <rds:CreateProcedure ProcName="RunSync" />
</Batch>
